package boot

import (
	"github.com/gin-gonic/gin"
	"store/app/middleware"
	"store/global"
	"store/utils/common"
)

func AppRun() *gin.Engine {
	if common.IsDevEnv() {
		gin.SetMode(gin.ReleaseMode)
	}
	r := gin.New()
	//设置上传文件大小限制
	r.MaxMultipartMemory = global.Config.App.UploadMaxM << 20
	r.Use(gin.Recovery())
	//跨域中间件
	if global.Config.Http.UseCrossMiddleware {
		r.Use(middleware.Cross())
	}
	r.Use(middleware.UUID())
	return r
}
